home *** CD-ROM | disk | FTP | other *** search
/ Netware Super Library / Netware Super Library.iso / drivers / nics / pktdrv7 / defs.asm < prev    next >
Encoding:
Assembly Source File  |  1990-07-26  |  4.8 KB  |  146 lines

  1. majver        equ    7        ;version number of the infrastructure.
  2.  
  3. MAX_ADDR_LEN    equ    16        ;maximum number of bytes in our address.
  4.  
  5. MAX_HANDLE    equ    10        ;maximum number of handles.
  6.  
  7. MAX_P_LEN    equ    8        ;maximum type length
  8.  
  9. MAX_MULTICAST    equ    8        ;maximum number of multicast addresses.
  10.  
  11. ;  Copyright, 1988, 1989, Russell Nelson
  12.  
  13. ;   This program is free software; you can redistribute it and/or modify
  14. ;   it under the terms of the GNU General Public License as published by
  15. ;   the Free Software Foundation, version 1.
  16. ;
  17. ;   This program is distributed in the hope that it will be useful,
  18. ;   but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. ;   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. ;   GNU General Public License for more details.
  21. ;
  22. ;   You should have received a copy of the GNU General Public License
  23. ;   along with this program; if not, write to the Free Software
  24. ;   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  25.  
  26. HT    equ    09h
  27. CR    equ    0dh
  28. LF    equ    0ah
  29.  
  30. ;
  31. ;  Packet Driver Error numbers
  32. NO_ERROR    equ    0        ;no error at all.
  33. BAD_HANDLE    equ    1        ;invalid handle number
  34. NO_CLASS    equ    2        ;no interfaces of specified class found
  35. NO_TYPE        equ    3        ;no interfaces of specified type found
  36. NO_NUMBER    equ    4        ;no interfaces of specified number found
  37. BAD_TYPE    equ    5        ;bad packet type specified
  38. NO_MULTICAST    equ    6        ;this interface does not support
  39.                     ;multicast
  40. CANT_TERMINATE    equ    7        ;this packet driver cannot terminate
  41. BAD_MODE    equ    8        ;an invalid receiver mode was specified
  42. NO_SPACE    equ    9        ;operation failed because of
  43.                     ;insufficient space
  44. TYPE_INUSE    equ    10        ;the type had previously been accessed,
  45.                     ;and not released.
  46. BAD_COMMAND    equ    11        ;the command was out of range, or not
  47.                     ;implemented
  48. CANT_SEND    equ    12        ;the packet couldn't be sent (usually
  49.                     ;hardware error)
  50. CANT_SET    equ    13        ;hardware address couldn't be changed
  51.                     ;(more than 1 handle open)
  52. BAD_ADDRESS    equ    14        ;hardware address has bad length or
  53.                     ;format
  54. CANT_RESET    equ    15        ;Couldn't reset interface (more than
  55.                     ;1 handle open).
  56. BAD_IOCB    equ    16        ;an invalid iocb was specified
  57.  
  58. ;a few useful Ethernet definitions.
  59. RUNT        equ    60        ;smallest legal size packet, no fcs
  60. GIANT        equ    1514        ;largest legal size packet, no fcs
  61. EADDR_LEN    equ    6        ;Ethernet address length.
  62. ARCADDR_LEN    equ    1
  63.  
  64. ;The following two macros are used to manipulate port addresses.
  65. ;Use loadport to initialize dx.  Use setport to set a specific port on
  66. ;the board.  setport remembers what the current port number is, but beware!
  67. ;setport assumes that code is being executed in the same order as the
  68. ;code is presented in the source file.  Whenever this assumption is violated,
  69. ;you need to enter another loadport.  Some, but not all examples are:
  70. ;in a loop with multiple setports, or a backward jump over a setport, or
  71. ;a forward jump over a setport.  If you have any doubt, consult the
  72. ;individual driver sources for examples of usage.  If you suspect that
  73. ;you have too few loadports, define the symbol "no_confidence".  This will
  74. ;force a loadport before every setport.
  75. loadport    macro
  76.     mov    dx,io_addr
  77. port_no    =    0
  78.     endm
  79.  
  80. ;change the port number from the current value to the new value.
  81. setport    macro    new_port_no
  82.     ifdef    no_confidence        ;define if you suspect that you don't
  83.         loadport        ;  have enough loadports, i.e. dx is
  84.     endif                ;  set to the wrong port.
  85.     if    new_port_no - port_no EQ 1
  86.         inc    dx
  87.     else
  88.         if    new_port_no - port_no EQ -1
  89.             dec    dx
  90.         else
  91.             if    new_port_no - port_no NE 0
  92.                 add    dx,new_port_no - port_no
  93.             endif
  94.         endif
  95.     endif
  96. port_no    =    new_port_no
  97.     endm
  98.  
  99. segmoffs    struc            ; defines offs as 0, segm as 2
  100. offs        dw    ?
  101. segm        dw    ?
  102. segmoffs    ends
  103.  
  104. CY    equ    0001h
  105. EI    equ    0200h
  106.  
  107. iocb        struc            ; as_send_pkt structure
  108. buffer        dd    ?        ; Pointer to the buffer
  109. len        dw    ?        ; Its length
  110. flags        db    ?        ; Some flags
  111. ret_code    db    ?        ; Completion code
  112. upcall        dd    ?        ; I/O completion upcall
  113. next        dd    ?        ; Private next pointer (queue)
  114. resv        db    4 dup (?)    ; Unused private data
  115. iocb        ends
  116.  
  117. DONE    equ    1        ; I/O complete flag
  118. CALLME    equ    2        ; Please upcall me flag
  119.  
  120.  
  121. send_queueempty    macro
  122. ; Check if send queue is empty.
  123. ; Enter with interrupts disabled.
  124. ; Exit with zr (zero) if empty, nz (not zero) if not.
  125. ; Destroys ax.
  126.     mov ax,    word ptr send_head    ; Queue empty?
  127.     or ax,    word ptr send_head+2
  128.     endm
  129.  
  130. send_peekqueue    macro
  131. ; Peek into the queue and get the next entry.
  132. ; Enter with interrupts disabled.
  133. ; Exit with es:di -> iocb.
  134.     les di, send_head    ; Get head segment:offset
  135.     endm
  136.  
  137. ; Bits in sys_features
  138. MICROCHANNEL    equ    02        ; a micro channel computer
  139. TWO_8259    equ    40h        ; 2nd 8259 exists
  140.  
  141. ; Bits in flagbyte
  142. CALLED_ETOPEN    equ    1        ; have called etopen
  143. D_OPTION    equ    2        ; delayed initialization
  144. N_OPTION    equ    4        ; Novell protocol conversion
  145. W_OPTION    equ    8        ; Windows upcall checking.
  146.